Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The use of
fread
function in example code is:libopusenc/examples/opusenc_example.c
Lines 31 to 32 in e4285b5
But according to
fread
documentation, although the 2nd and 3rd parameters will be multiplied together, the return value will be different(in case of full-read, the return value will be equal to 3rd parameter according to my test locally). So the variableret
will be different(prior is 256, current is 512, which equals to the length of buf).Only this issue is fixed, the 3rd parameter of
ope_encoder_write
will write all data correctly. Otherwise it will write only half of the data, resulting in only half time length of the opus product in my local test(I'm using a 16000 sample rate, 1 channel pcm file for test. Already changed theope_encoder_create_file
parameters to16000, 1, 0
for the local test).Meanwhile, I'm not sure why we add a
2*
with READ_SIZE for thebuf
, we can remove both2*
if it's useless.